<{include file="app/header.tpl"}>
<style>
.tips { width: 100%; margin-top: 15px; padding: 1em; border: 1px dotted orange; background-color: #f44c06; color: #eee;
    text-align: center; font-size: 14px;
}
.comments { width: 100%; margin-top: 15px; padding: 1em; border: 1px dotted #ccc; background-color: #eee; color: red; }
.gift { line-height: 1.5em;
    background-color: #eee; color: #444; border: 1px dotted #ccc; padding: 1em;
}
/*#shareBox { line-height: 1.5em;
    margin: 10px 0;
    background-color: #fee; color: #999; font-size: 14px; border: 1px dotted #ccc; padding: 1em;
    display: none;
}*/

.userList { margin-bottom: 1em;
    background-color: #eee; color: #444; border: 1px dotted #ccc; padding: 1em;
}
.userList .addr { border-bottom: 1px dotted #ccc; line-height: 2em;}

.alert_bg {  display: none; position: fixed; z-index: 100; top: 0; left: 0; width: 100%; height: 100%; background: #000; opacity: .8; text-align: center; }
.alert_bg .text { color: #fff; font-size: 18px; line-height: 36px; }
.alert_bg .one { margin-top: 80px; color: #fff; }
.alert_bg .close { width: 20px; height: 20px;  background: url(/resource/wei/imgs/cart_close_btn2.png);  -webkit-background-size: 20px 20px; background-size: 20px 20px; position: absolute; top: 10px; left: 10px; }
.alert_bg .Instruction { width: 72px; height: 72px;  background: url(/resource/wei/imgs/Jump.png);  -webkit-background-size: 72px 72px; background-size: 72px 72px; position: absolute; top: 0; right: 15px; }
</style>
<script>
function showAddress() {
    $('#buy-address').show();

    var addr = $('input:radio[name="addressId"]:checked');
    if (addr.length == 1)
    {
        $('form[name="getGift"]').submit();
    }
}

function show_bg() {
    $('.alert_bg').show();
}

function hide_bg() {
    $('.alert_bg').hide();
}

</script>

<div class="alert_bg">

    <em class="close" onclick="hide_bg();"></em>
    <em class="Instruction"></em>
    <p class="one text">请点击右上角</p>
    <p class="text">通过【发送给朋友】功能</p>
    <p class="text">或【分享到朋友圈】功能</p>
    <p class="text">把这份礼物送给朋友</p>

</div>

<{foreach from=$order.arrGoodsInfo item="goods"}>
<div class="order-detail-header">

    <div class="left"><img class="img" src="<{$goods.goods.thumbsrc}>"></div>
    <div class="right">
                <p class="line"><{$goods.goods.name}></p>
                <p class="line"><{$goods.goods.attr.desc}></p>
                <p class="line">￥<{$goods.price/100|number_format:2}> x <{$goods.quantity}>件</p></div>

</div>
<{/foreach}>


<div class="order-detail-status">
    <h3 class="title">红包订单: <{$order.orderNo}></h3>
    <h3 class="title">红包状态: <{$order.statusName}></h3>

<{if $order.commentsUser}>
<div class="comments">
    <p><{$order.commentsUser}></p>
</div>
<{/if}>

    <{if $order.status == 0}>
        <{if $order.uid == $global_user.userUid}>
            <p class="line"><a href="/payment/weixin/order?orderNo=<{$order.orderNo}>">点击支付</a></p>
        <{else}>
            <div class="tips">红包主人尚未付款, 请等待</p>
        <{/if}>
    <{elseif $order.status <= 3}>

        <{if $order.uid == $global_user.userUid}>
            <h3 class="title">红包总数: <{$order.countsQuantity}>件, 剩余<{$countsLeft}>件</h3>
            <h3 class="title">领取红包者列表:</h3>
            <div class="userList">
            <{foreach from=$gift.users item="user"}>
                <div class="addr">
                    <p class="no">快递单号: <{$user.deliverNo}></p>
                    <p>收货地址:
                        <{$user.addrUserName}>,
                        <{$user.addrTelNumber}>,
                        <{$user.addrDetailInfo}>
                    </p>
                </div>
            <{/foreach}>
            <p>&nbsp;</p>
            </div>

            <p class="line"><a href="javascript:;" onclick="show_bg();">送给朋友</a></p>
            <!-- <div id="shareBox">
                通过微信分享本页面到你的微信好友，微信朋友圈，即可转送礼物!
            </div> -->

        <{elseif $gift.userHasGift}>
            <h3 class="title">红包总数: <{$order.countsQuantity}>件, 剩余<{$countsLeft}>件</h3>
            <div class="gift">
            <p>我的礼物: <{$order.title}> (1件)</p>
            <p>收货地址:
                <{$gift.userAddress.addrUserName}>,
                <{$gift.userAddress.addrTelNumber}>,
                <{$gift.userAddress.addrDetailInfo}>
            </p>

            <{if $gift.userAddress.deliverNo }>
                <p>快递单号: <{$gift.userAddress.deliverNo}></p>
            <{else}>
                <p>请等待发货</p>
            <{/if}>
            </div>

            <p class="line"><a href="javascript:;" onclick="show_bg();">我要转送</a></p>
            <!-- <div id="shareBox">
                通过微信分享本页面到你的微信好友，微信朋友圈，即可转送礼物!
            </div> -->
        <{elseif $countsLeft > 0 }>
            <h3 class="title">红包总数: <{$order.countsQuantity}>件, 已领取<{$gift.countsGift}>件</h3>
            <{include file="app/order/input_address.tpl"}>
            <p class="line"><a href="javascript:;" onclick="return showAddress()">我要领取</a></p>
            <p class="line"><a href="javascript:;" onclick="show_bg();">我要转送</a></p>
            <!-- <div id="shareBox">
                通过微信分享本页面到你的微信好友，微信朋友圈，即可转送礼物!
            </div> -->
        <{else}>
            <h3 class="title">红包总数: <{$order.countsQuantity}>件, 已领取<{$gift.countsGift}>件</h3>
            <div class="tips">红包已结束，谢谢！</div>
        <{/if}>
    <{else}>
        <div class="tips">红包已结束，谢谢！</div>
    <{/if}>
</div>

<{include file="app/weixin_share.tpl"}>
<{include file="app/footer.tpl"}>
